package com.googlecode.continuity.core.server.mvc.controller;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.servlet.mvc.Controller;
import com.googlecode.continuity.core.server.mvc.ContinuityModel;

/**
 * TestController serves a testpage for development purposes.
 *
 * todo: replace with generic controller?
 *
 * @author Peter Schmitt <aragos@aragos.de>
 */
public class TestController implements Controller {
  /**
   * Logger for this class and subclasses
   */
  protected final Log logger = LogFactory.getLog(getClass());

  /**
   * Returns a generic model.
   * @param request http request
   * @param response http response
   * @return simple model
   * @throws ServletException
   * @throws IOException
   */
  public ModelAndView handleRequest(HttpServletRequest request, HttpServletResponse response)
      throws ServletException, IOException {

    ContinuityModel model = new ContinuityModel();

    logger.info("Returning test view.");
    return new ModelAndView("test", model);
  }

}
